Skip to content

Conversation

zjffun
Copy link

@zjffun zjffun commented May 10, 2020

I'm not sure if I misunderstood this note. According to:

https://tc39.es/ecma262/#sec-performpromisethen

Else if promise.[[PromiseState]] is fulfilled, then
---Let value be promise.[[PromiseResult]].
---Let fulfillJob be NewPromiseReactionJob(fulfillReaction, value).

https://tc39.es/ecma262/#sec-newpromisereactionjob

If handler is undefined, then
---If type is Fulfill, let handlerResult be NormalCompletion(argument).

if you don't provide then() a non-function, the next then() resolve function will passed the value the current resolve function passed.

eg:

> Promise.resolve(42).then(24).then(d => console.log(d))
// 42

> Promise.resolve(42).then({}, ()=>{}).then(d => console.log(d))
// 42

> Promise.resolve(42).then().then(d => console.log(d))
// 42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant